<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>SphinxClient 类</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinx.examples.html">范例</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div>
 <div class="up"><a href="book.sphinx.html">Sphinx</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.sphinxclient" class="reference">
 <h1 class="title">SphinxClient 类</h1>
 

 <div class="partintro"><p class="verinfo">(PECL sphinx &gt;= 0.1.0)</p>


  <div class="section" id="sphinxclient.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    SphinxClient 为 Sphinx 提供了面向对象的接口.
   </p>
  </div>


  <div class="section" id="sphinxclient.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">SphinxClient</strong>
     </span>
     {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="sphinxclient.addquery.html" class="methodname">addQuery</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code><span class="initializer"> = &quot;*&quot;</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$comment</code><span class="initializer"> = &quot;&quot;</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="sphinxclient.buildexcerpts.html" class="methodname">buildExcerpts</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$docs</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$words</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$opts</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="sphinxclient.buildkeywords.html" class="methodname">buildKeywords</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">bool</span> <code class="parameter">$hits</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.close.html" class="methodname">close</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="sphinxclient.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="sphinxclient.escapestring.html" class="methodname">escapeString</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="sphinxclient.getlasterror.html" class="methodname">getLastError</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="sphinxclient.getlastwarning.html" class="methodname">getLastWarning</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.open.html" class="methodname">open</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="sphinxclient.query.html" class="methodname">query</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code><span class="initializer"> = &quot;*&quot;</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$comment</code><span class="initializer"> = &quot;&quot;</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="sphinxclient.resetfilters.html" class="methodname">resetFilters</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="sphinxclient.resetgroupby.html" class="methodname">resetGroupBy</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="sphinxclient.runqueries.html" class="methodname">runQueries</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setarrayresult.html" class="methodname">setArrayResult</a></span>
    ( <span class="methodparam"><span class="type">bool</span> <code class="parameter">$array_result</code><span class="initializer"> = false</span></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setconnecttimeout.html" class="methodname">setConnectTimeout</a></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$timeout</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setfieldweights.html" class="methodname">setFieldWeights</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$weights</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setfilter.html" class="methodname">setFilter</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$values</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclude</code><span class="initializer"> = false</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setfilterfloatrange.html" class="methodname">setFilterFloatRange</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$min</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$max</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclude</code><span class="initializer"> = false</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setfilterrange.html" class="methodname">setFilterRange</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$min</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$max</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclude</code><span class="initializer"> = false</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setgeoanchor.html" class="methodname">setGeoAnchor</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attrlat</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$attrlong</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$latitude</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$longitude</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setgroupby.html" class="methodname">setGroupBy</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$func</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$groupsort</code><span class="initializer"> = &quot;@group desc&quot;</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setgroupdistinct.html" class="methodname">setGroupDistinct</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setidrange.html" class="methodname">setIDRange</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$min</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$max</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setindexweights.html" class="methodname">setIndexWeights</a></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$weights</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setlimits.html" class="methodname">setLimits</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$limit</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$max_matches</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$cutoff</code><span class="initializer"> = 0</span></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setmatchmode.html" class="methodname">setMatchMode</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setmaxquerytime.html" class="methodname">setMaxQueryTime</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$qtime</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setoverride.html" class="methodname">setOverride</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$values</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setrankingmode.html" class="methodname">setRankingMode</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$ranker</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setretries.html" class="methodname">setRetries</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$count</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$delay</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setselect.html" class="methodname">setSelect</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$clause</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setserver.html" class="methodname">setServer</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$server</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="sphinxclient.setsortmode.html" class="methodname">setSortMode</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$sortby</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span><span class="methodname"><a href="sphinxclient.status.html" class="methodname">status</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="sphinxclient.updateattributes.html" class="methodname">updateAttributes</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$attributes</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$values</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$mva</code><span class="initializer"> = false</span></span>
  ] )</div>

   }</div>


  </div>

 </div>

 






















































































































































































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a> — Add query to multi-query batch</li><li><a href="sphinxclient.buildexcerpts.html">SphinxClient::buildExcerpts</a> — Build text snippets</li><li><a href="sphinxclient.buildkeywords.html">SphinxClient::buildKeywords</a> — Extract keywords from query</li><li><a href="sphinxclient.close.html">SphinxClient::close</a> — 关闭先前打开的持久连接</li><li><a href="sphinxclient.construct.html">SphinxClient::__construct</a> — Create a new SphinxClient object</li><li><a href="sphinxclient.escapestring.html">SphinxClient::escapeString</a> — Escape special characters</li><li><a href="sphinxclient.getlasterror.html">SphinxClient::getLastError</a> — Get the last error message</li><li><a href="sphinxclient.getlastwarning.html">SphinxClient::getLastWarning</a> — Get the last warning</li><li><a href="sphinxclient.open.html">SphinxClient::open</a> — 建立到搜索服务端的持久连接</li><li><a href="sphinxclient.query.html">SphinxClient::query</a> — 执行搜索查询</li><li><a href="sphinxclient.resetfilters.html">SphinxClient::resetFilters</a> — Clear all filters</li><li><a href="sphinxclient.resetgroupby.html">SphinxClient::resetGroupBy</a> — Clear all group-by settings</li><li><a href="sphinxclient.runqueries.html">SphinxClient::runQueries</a> — Run a batch of search queries</li><li><a href="sphinxclient.setarrayresult.html">SphinxClient::setArrayResult</a> — 控制搜索结果集的返回格式</li><li><a href="sphinxclient.setconnecttimeout.html">SphinxClient::setConnectTimeout</a> — Set connection timeout</li><li><a href="sphinxclient.setfieldweights.html">SphinxClient::setFieldWeights</a> — Set field weights</li><li><a href="sphinxclient.setfilter.html">SphinxClient::setFilter</a> — 增加整数值过滤器</li><li><a href="sphinxclient.setfilterfloatrange.html">SphinxClient::setFilterFloatRange</a> — Add new float range filter</li><li><a href="sphinxclient.setfilterrange.html">SphinxClient::setFilterRange</a> — Add new integer range filter</li><li><a href="sphinxclient.setgeoanchor.html">SphinxClient::setGeoAnchor</a> — Set anchor point for a geosphere distance calculations</li><li><a href="sphinxclient.setgroupby.html">SphinxClient::setGroupBy</a> — Set grouping attribute</li><li><a href="sphinxclient.setgroupdistinct.html">SphinxClient::setGroupDistinct</a> — Set attribute name for per-group distinct values count calculations</li><li><a href="sphinxclient.setidrange.html">SphinxClient::setIDRange</a> — Set a range of accepted document IDs</li><li><a href="sphinxclient.setindexweights.html">SphinxClient::setIndexWeights</a> — Set per-index weights</li><li><a href="sphinxclient.setlimits.html">SphinxClient::setLimits</a> — 设置返回结果集偏移量和数目</li><li><a href="sphinxclient.setmatchmode.html">SphinxClient::setMatchMode</a> — 设置全文查询的匹配模式</li><li><a href="sphinxclient.setmaxquerytime.html">SphinxClient::setMaxQueryTime</a> — Set maximum query time</li><li><a href="sphinxclient.setoverride.html">SphinxClient::setOverride</a> — Sets temporary per-document attribute value
   overrides</li><li><a href="sphinxclient.setrankingmode.html">SphinxClient::setRankingMode</a> — Set ranking mode</li><li><a href="sphinxclient.setretries.html">SphinxClient::setRetries</a> — Set retry count and delay</li><li><a href="sphinxclient.setselect.html">SphinxClient::setSelect</a> — Set select clause</li><li><a href="sphinxclient.setserver.html">SphinxClient::setServer</a> — 设置searchd的主机名和TCP端口</li><li><a href="sphinxclient.setsortmode.html">SphinxClient::setSortMode</a> — Set matches sorting mode</li><li><a href="sphinxclient.status.html">SphinxClient::status</a> — Queries searchd status</li><li><a href="sphinxclient.updateattributes.html">SphinxClient::updateAttributes</a> — Update document attributes</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sphinx.examples.html">范例</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="sphinxclient.addquery.html">SphinxClient::addQuery</a></div>
 <div class="up"><a href="book.sphinx.html">Sphinx</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
